// import request from '@/utils/request'
/**
 * reason api
 */
import request from "./axios-config";
export default {
	//查询reason列表
	findAll() {
		return new Promise((resolve, reject) => {
			return request({
					url: "/reasonRest/findAll",
					method: "get"
				})
				.then(response => {
					resolve(response);
				})
				.catch(error => {
					reject(error);
				});
		});
	},
	//添加
	add(fromData) {
		return new Promise((resolve, reject) => {
			return request({
					url: "/reasonRest/add",
					method: "post",
					data:fromData
				})
				.then(response => {
					resolve(response);
				})
				.catch(error => {
					reject(error);
				});
		});
	},
	//停用
	stop(fromData) {
		return new Promise((resolve, reject) => {
			return request({
					url: "/reasonRest/stop?aid="+fromData,
					method: "get"
				})
				.then(response => {
					resolve(response);
				})
				.catch(error => {
					reject(error);
				});
		});
	},
	//编辑
	edit(fromData) {
		return new Promise((resolve, reject) => {
			return request({
					url: "/reasonRest/update",
					method: "post",
					data:fromData
				})
				.then(response => {
					resolve(response);
				})
				.catch(error => {
					reject(error);
				});
		});
	},
	//删除
	del(fromData) {
		return new Promise((resolve, reject) => {
			return request({
					url: "/reasonRest/delete?rid="+fromData,
					method: "get"
				})
				.then(response => {
					resolve(response);
				})
				.catch(error => {
					reject(error);
				});
		});
	},
	//findSubreason
	findSubreason(rid){
		return new Promise((resolve, reject) => {
			return request({
					url: "/reasonRest/subreason?rid="+fromData,
					method: "get"
				})
				.then(response => {
					resolve(response);
				})
				.catch(error => {
					reject(error);
				});
		});
	},
	//添加子原因
	addsub(fromData) {
		return new Promise((resolve, reject) => {
			return request({
					url: "/reasonRest/addsub",
					method: "post",
					data:fromData
				})
				.then(response => {
					resolve(response);
				})
				.catch(error => {
					reject(error);
				});
		});
	},
}
